/**
* Copyright @ 2023 iAuto (Shanghai) Co., Ltd.
* All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are NOT permitted except as agreed by
* iAuto (Shanghai) Co., Ltd.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/



import { getDateTime } from '@/utils/soa/utils';
import { useRequest } from 'ahooks';
import { Col, Descriptions, Image, Row } from 'antd';
import IAutoDetail from '@/components/soa/IAutoDetail';
import React from 'react';
import styles from './detailScene.less';
import { oneCarOneGearSceneDetail } from '@/services/soa/oneCarOneGearScene';

// TODO: 类型
const Index = ({ location }) => {
  const { query } = location;

  // 请求回来的参数
  const { data, loading: requestLoading } = useRequest(oneCarOneGearSceneDetail, {
    defaultParams: [query?.sceneUuid],
  });

  return (
    <IAutoDetail className={styles.main} title={'场景详情'} loading={requestLoading}>
      <Row>
        <Col span={24} className={styles.description}>
          <Descriptions column={1}>
            <Descriptions.Item label={'场景名'}>{(data?.data?.name || '')}
            </Descriptions.Item>
            <Descriptions.Item label={'场景描述'} className={styles.descriptionScene}>{data?.data?.description}</Descriptions.Item>
            <Descriptions.Item label={'场景图标'}><Image src={data?.data?.iconUrl} preview={false} className={styles.icon}/></Descriptions.Item>
            <Descriptions.Item label={'场景背景'}><Image src={data?.data?.backgroundPicUrl} preview={false} className={styles.background}/></Descriptions.Item>
            <Descriptions.Item label={'创建时间'}>
              {getDateTime(data?.data?.createTime)}
            </Descriptions.Item>
            <Descriptions.Item label={'更新时间'}>
              {getDateTime(data?.data?.updateTime)}
            </Descriptions.Item>
          </Descriptions>
        </Col>
      </Row>
    </IAutoDetail>
  );
};

// export default connect(({ user, loading }: { user: IUser; loading: Loading }) => ({
//   user,
//   loading: loading.models.resource,
// }))(Index);
export default Index;
